package com.example.demo.zabbix.request.builder.request;

import com.example.demo.zabbix.request.BaseRequest;

import java.util.HashMap;
import java.util.Map;

/**
 * https://www.zabbix.com/documentation/4.0/manual/api
 */
public class AuthRequestBuilder extends RequestBuilder<Map<String,Object>>{
    private String userName;
    private String password;

    public AuthRequestBuilder(){
        super("user.login");
        baseRequest.setParams(new HashMap<>());
    }
    public AuthRequestBuilder(Long id){
        super("user.login",id);
        baseRequest.setParams(new HashMap<>());
    }

    public AuthRequestBuilder setUserName(String userName) {
        this.userName = userName;
        return this;
    }

    public AuthRequestBuilder setPassword(String password) {
        this.password = password;
        return this;
    }

    @Override
    public BaseRequest builder(){
        Map<String,Object> params = new HashMap<>();
        params.put("user",userName);
        params.put("password",password);
        baseRequest.setParams(params);
        return baseRequest;
    }
}
